package com.giraffe.device.controller.admin;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author ldx
 * @Date 2024/01/17 15:15
 **/
@RestController
@RequestMapping("test")
public class TestController {

    @Resource
    private KafkaTemplate<String,String> kafkaTemplate;


    @GetMapping("send")
    public void send(@RequestParam("topic") String topic){
        System.out.println("send");
        kafkaTemplate.send("mqtt_data_topic", topic);
    }


}
